package com.lindroid.gesturelock;

/**
 * Created by linyu on 2017/6/1.
 */

public class Point {
    static int STATE_NORMAL = 0;
    static int STATE_PRESS = 1;
    static int STATE_ERROR = 2;

    float x, y;
    int state = STATE_NORMAL;

    public Point(float x, float y) {
        this.x = x;
        this.y = y;
    }

    /**
     * 计算手指按下抬起两点间的距离
     *
     * @param point
     * @return
     */
    public float distance(Point point) {
        //Math.sqrt求正平方根
        float distance = (float) Math.sqrt((x - point.x) * (x - point.x) + (y - point.y) * (y - point.y));
        //x和y是圆心的坐标，point.x和point.y是手指按下的点的横纵坐标
        return distance;
    }
}
